package com.zzy.ymcc.fallback;

import com.zzy.ymcc.doc.CourseDoc;
import com.zzy.ymcc.enums.GlobalExceptionCode;
import com.zzy.ymcc.feign.CourseEsService;
import com.zzy.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CourseEsServiceFallbackFactory implements FallbackFactory<CourseEsService> {
    @Override
    public CourseEsService create(Throwable throwable) {
        return new CourseEsService() {
            @Override
            public JSONResult courseEsAdd(CourseDoc courseDoc) {
                return JSONResult.error(GlobalExceptionCode.ERROR);
            }
        };
    }
}
